package com.xx.job.seataaccountservice2003.controller;

import com.xx.job.common.CommonResult;
import com.xx.job.entity.Account;
import com.xx.job.seataaccountservice2003.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AccountController {

    @Autowired
    private AccountService accountService;

    // 127.0.0.1:2003/account/update?userId=3&money=20
    @RequestMapping("/account/update")
    public CommonResult update(@RequestBody Account account){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        accountService.update(account);
        return new CommonResult(200,"修改余额成功！");
    }
}
